package org.bangumibuddy.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.bangumibuddy.entity.UserEntity;


@Mapper
public interface UserMapper{

    @Select("select * from `user` where userName = #{username}")
    UserEntity getByUsername(String username);

    @Select("select * from `user` where userName = #{username} or email = #{username}")
    UserEntity getByUsernameOrEmail(String username);

    @Insert("INSERT INTO `user` (userName, email, password, createTime, role) VALUES (#{userName}, #{email}, #{password}, #{createTime}, #{role})")
    int insertUser(UserEntity user);
}
